package com.example.dao;

import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.example.entity.JB1Material;
import com.example.entity.MaterialPart;
import com.example.entity.PartMaterialDetail;
import com.example.entity.PreWorkPackageDrawings;
import com.example.entity.PreWorkPackageMaterialTheoreticalUseQuantity;
import com.example.entity.PreWorkPackageParts;
import com.example.entity.RequiredMaterialDetail;
import com.example.entity.SchedulePlanEngineering;
import com.example.entity.SurplusMaterial;

@Mapper
public interface UxpmStckMapper {

	/**
	 * 将入库表入库数量同步到即时库存中 修改即时表中物料数量
	 * 
	 * @param list
	 * @return
	 */
	public int updateUxpmStckTotal(List<Map<String, String>> list);

	public int updateUxpmStckTotal2(Map<Object, String> list);

	/**
	 * JobcArd 下发后锁定物料母材
	 * 
	 * @param list
	 * @return
	 */
	public int updateUxpmStck_JobcArd_Active_bulk(@Param("drawingNo") String drawingNo, @Param("rev") String rev);

	
	/**
	 * JobcArd 下发后锁定物料母材
	 * 
	 * @param list
	 * @return
	 */
	public int updateUxpmStck_JobcArd_Active_bulk2(@Param("list")List< Map<String, String>> list);
	
	/**
	 * JobcArd 下发后锁定物料余料
	 * 
	 * @param list
	 * @return
	 */
	public int updateUxpmStck_JobcArd_Active_remnant(@Param("drawingNo") String drawingNo, @Param("rev") String rev);

	/**
	 * JobcArd 下发后锁定物料零件
	 * 
	 * @param list
	 * @return
	 */
	public int updateUxpmStck_JobcArd_Active_part(@Param("drawingNo") String drawingNo, @Param("rev") String rev);
 
	public List<PreWorkPackageParts> selectUxpmstck_DrawingNoList(List<PreWorkPackageDrawings> list,@Param("projectNumber") Integer projectNumber);

	/**
	 * 管线专业查询图纸所需要的母材总长度
	 * 
	 * @param list
	 * @return
	 */
	public List<PreWorkPackageMaterialTheoreticalUseQuantity> selectUxpmstck_DrawingNoList_material_quantity(List<PreWorkPackageDrawings> list,@Param("projectNumber") Integer projectNumber);

	
	/**
	 * 管线专业查询工作包下管件使用总数量
	 * 
	 * @param list
	 * @return
	 */
	public List<PreWorkPackageMaterialTheoreticalUseQuantity> selectUxpmstck_DrawingNoList_material_quantity2(List<PreWorkPackageDrawings> list,@Param("projectNumber") Integer projectNumber);

	
	
	
	/**
	 * 根据母材编码查询库存拥有数量
	 * 
	 * @return
	 */
	public List<Map<String, String>> select_bulk_ACTIVE_QTY(@Param("list")List<PreWorkPackageMaterialTheoreticalUseQuantity> list,@Param("projectNumber") Integer projectNumber);

	/**
	 * 修改母材数量
	 * 
	 * @param list
	 * @return
	 */
	public  int UPDATE_bulk_ACTIVE_QTY(List<PreWorkPackageMaterialTheoreticalUseQuantity> list,@Param("projectNumber") Integer projectNumber);

	/**
	 * 锁库存
	 * @param list
	 * @param projectNumber
	 * @return
	 */
	public  int UPDATE_bulk_ACTIVE_QTY_Maps(List<Map<String, String>> list,@Param("projectNumber") Integer projectNumber);

	
	/**
	 * 释放库存
	 * @param list
	 * @param projectNumber
	 * @return
	 */
	public  int UPDATE_bulk_ACTIVE_QTY_Freed_Maps(List<Map<String, String>> list,@Param("projectNumber") Integer projectNumber);

	
	
	/**
	 * 查询即时库存被修改信息ID
	 * 
	 * @param MATERIAL_CODEList
	 * @param PROJECT_IDList
	 * @return
	 */

	public List<Map<String, Object>> selectUxpmstckId(@Param("MATERIAL_CODEList") List<String> MATERIAL_CODEList,
			@Param("PROJECT_IDList") List<Object> PROJECT_IDList);

	/**
	 * 插入物料信息
	 * 
	 * @return
	 */
	public int insertUxpmstck_ListMap(@Param("list") List<Map<String, String>> list, @Param("date") String date,
			@Param("id") int id, @Param("discipline") String discipline, @Param("materialSort") String materialSort,
			@Param("projectNumber") Integer projectNumber);

	/**
	 * 插入数据权限
	 * 
	 * @return
	 */
	public int insertUxpmstck_PERM_ListMap(@Param("list") List<Map<String, String>> list, @Param("id") int id);

	

	/**
	 * 插入物料信息   母材表  
	 * 
	 * @return
	 */
	public int insertUxmate_ListMap(@Param("list") List<Map<String, String>> list, @Param("date") String date,
			@Param("id") int id, @Param("discipline") String discipline, @Param("materialSort") String materialSort,@Param("projectNumber") Integer projectNumber);

	/**
	 * 插入物料信息 母材表  数据权限
	 * 
	 * @return
	 */
	public int insertUxmate_PERM_ListMap(@Param("list") List<Map<String, String>> list, @Param("id") int id);

	
	
	/**
	 * 插入物料信息 公司级 母材表  
	 * 
	 * @return
	 */
	public int insertUxmatex3_Company_ListMap(@Param("list") List<Map<String, String>> list, @Param("date") String date,
			@Param("id") int id, @Param("discipline") String discipline, @Param("materialSort") String materialSort);

	/**
	 * 插入物料信息 公司级 数据权限
	 * 
	 * @return
	 */
	public int insertUxmatex3_PERM_ListMap(@Param("list") List<Map<String, String>> list, @Param("id") int id);

	/**
	 * 查询表中所有物料编码
	 * 
	 * @return
	 */
	public List<String> selectUxpmstck_materialCode();

	/**
	 * 将表中最大ID与系统记录的进行同步
	 * 
	 * @return
	 */
	public int UPDATE_SEQUENCE_UxpmstckMaxID();

	/**
	 * 查询某专业 所有母材编码
	 * 
	 * @return
	 */
	public List<String> selectUxpmstck_materialCode_bulk(@Param("discipline") String discipline,@Param("projectNumber") Integer projectNumber);
	/**
	 *  查询某专业 所有设备编码  
	 * @param discipline
	 * @param projectNumber
	 * @return
	 */
	public List<String> selectUxpmstck_materialCode_tag(@Param("discipline") String discipline,@Param("projectNumber") Integer projectNumber);
	/**
	 * 查询某专业 所有零件编码
	 * 
	 * @return
	 */
	public List<String> selectUxpmstck_materialCode_part(@Param("discipline") String discipline,@Param("projectNumber") Integer projectNumber);

	/**
	 * 查询某专业 所有余料编码
	 * 
	 * @return
	 */
	public List<String> selectUxpmstck_materialCode_remnant(@Param("discipline") String discipline,@Param("projectNumber") Integer projectNumber);

	/**
	 * 查询某专业 所有构件编码
	 * 
	 * @return
	 */
	public List<String> selectUxpmstck_materialCode_fabrication(@Param("discipline") String discipline,@Param("projectNumber") Integer projectNumber);

	/**
	 * 根据图纸编号关联的零件物料信息
	 * 
	 * @return
	 */
	public List<MaterialPart> selectUxpmstck_Drawing_No_Part(@Param("Drawing") String Drawing,	@Param("DrawingRev") String DrawingRev,@Param("projectNumber") Integer projectNumber);

	public List<RequiredMaterialDetail> selectUxpmstck_Drawing_No_Part2(@Param("Drawing") String Drawing,	@Param("DrawingRev") String DrawingRev,@Param("projectNumber") Integer projectNumber);

	
	
	/**
	 * 根据图纸查询余料
	 * 
	 * @param data
	 * @return
	 */
	public List<SurplusMaterial> selectUxpmstck_Drawing_No_Remnant(@Param("Drawing") String Drawing,	@Param("DrawingRev") String DrawingRev,@Param("projectNumber") Integer projectNumber);

	/**
	 * 根据图纸查询母材
	 * 
	 * @param data
	 * @return
	 */
	public List<RequiredMaterialDetail> selectUxpmstck_Drawing_No_bulk(@Param("Drawing") String Drawing,	@Param("DrawingRev") String DrawingRev,@Param("projectNumber") Integer projectNumber);

	/**
	 * 根据图纸查询构件
	 * 
	 * @param data
	 * @return
	 */
	public List<PartMaterialDetail> selectUxpmstck_Drawing_No_Fabrication(@Param("Drawing") String Drawing,	@Param("DrawingRev") String DrawingRev,@Param("projectNumber") Integer projectNumber);

	/**
	 * PI根据图纸查询构件 
	 *  
	 * @param data
	 * @return
	 */
	public List<PartMaterialDetail> selectUxpmstck_Drawing_No_FabricationPI(@Param("Drawing") String Drawing,	@Param("DrawingRev") String DrawingRev,@Param("projectNumber") Integer projectNumber);

	/**
	 * 根据图纸查询设备
	 * 
	 * @param data
	 * @return
	 */
	public List<RequiredMaterialDetail> selectUxpmstck_Drawing_No_tag(@Param("Drawing") String Drawing,	@Param("DrawingRev") String DrawingRev,@Param("projectNumber") Integer projectNumber);

	/**
	 * 插入零件BP
	 * 
	 * @param list
	 * @return
	 */
	public int insertUxmatept(@Param("list") List<Map<String, String>> list, @Param("id") int id,
			@Param("projectNumber") Integer projectNumber);

	public int insertUxmateptPERM_ListMap(@Param("list") List<Map<String, String>> list, @Param("id") int id);

	/**
	 * 根据图纸查询相关物料信息
	 * 
	 * @param Drawing
	 * @param DrawingRev
	 * @return
	 */
	public List<Map<String, String>> select_Uxmateptlist(@Param("Drawing") String Drawing,
			@Param("DrawingRev") String DrawingRev,@Param("projectNumber") Integer projectNumber);

	/**
	 * 根据图纸查询相关物料信息
	 * 
	 * @param Drawing
	 * @param DrawingRev
	 * @return
	 */
	public List<PartMaterialDetail> select_UxmatepPartList(@Param("Drawing") String Drawing,
			@Param("DrawingRev") String DrawingRev,@Param("projectNumber") Integer projectNumber);
 
	public List<JB1Material> select_UxmatepList(@Param("Drawing") String Drawing,
			@Param("DrawingRev") String DrawingRev,@Param("projectNumber") String projectNumber);

	/**
	 * 查询零件BP最大ID
	 * 
	 * @return
	 */
	public Integer select_UxmateptMaxId();

	/**
	 * 查询表中最大ID
	 * 
	 * @return
	 */
	public Integer select_UxpmstckMaxID();

	/**
	 * 公司级母材表 最大ID
	 * 
	 * @return
	 */
	public Integer select_Uxmatex3MaxID();
	/**
	 *  母材表 最大ID
	 * 
	 * @return
	 */
	public Integer select_UxmateMaxID();
}
